package com.xy.tool.report;

/**
 * Created by zsp on 2018/12/6.
 */
public class Coord<TH, TV> {

    private TH col;
    private TV row;

    public Coord(){

    }

    public Coord(TH col, TV row){
        this.col = col;
        this.row = row;
    }

    public TH getCol() {
        return col;
    }

    public TV getRow() {
        return row;
    }

    public Coord ofCol(TH col) {
        this.col = col;
        return this;
    }

    public Coord ofRow(TV row) {
        this.row = row;
        return this;
    }

    @Override
    public String toString() {
        return "Coord{" +
                "col=" + col +
                ", row=" + row +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Coord<?, ?> coord = (Coord<?, ?>) o;

        if (col != null ? !col.equals(coord.col) : coord.col != null) return false;
        return row != null ? row.equals(coord.row) : coord.row == null;
    }

    @Override
    public int hashCode() {
        int result = col != null ? col.hashCode() : 0;
        result = 31 * result + (row != null ? row.hashCode() : 0);
        return result;
    }

}
